package com.csj.DesignPattern.menmento.white_box;

public class Client {
    public static void main(String[] args) {
        System.out.println("战斗前");

        GameRole gameRole = new GameRole();
        gameRole.initState();
        gameRole.showState();

        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setRoleStateMemento(gameRole.saveState());
        System.out.println("战斗后");

        gameRole.fight();
        gameRole.showState();

        System.out.println("恢复后");
        gameRole.recoverState(roleStateCaretaker.getRoleStateMemento());
        gameRole.showState();
    }
}
